<template>
	<view>
		<main-page v-slot:mainBody>
			<template v-if="list.length > 0">
				<view  class="mb10" v-for="(item, index) in list" :key="index">
					<article-item :obj="item" @handleLike="handleLike" />
				</view>
			</template>
			<template v-else>
				<empty content="暂无文章信息"></empty>
			</template>
		</main-page>
	</view>
</template>

<script>
	import mainPage from "../../components/main-page/main-page.vue"
	import articleItem from "../../components/article-item/article-item.vue"
	export default{
		components:{
			mainPage,
			articleItem
		},
		data(){
			return{
				list:[]
			}
		},
		methods:{
			handleLike(e){
				e.isLike = !e.isLike
				if(e.isLike){
					e.likeNum ++;
				}else{
					e.likeNum --;
				}
			},
		},
		onLoad(opt) {
			this.list = JSON.parse(opt.list)
			console.log(this.list);
		}
	}
</script>

<style>
</style>
